from flask import Blueprint, render_template
from flask_login import login_required

bp = Blueprint('annotate', __name__, url_prefix='/annotate')

@bp.route('/')
@login_required
def index():
    return render_template('annotate/index.html')

@bp.route('/<int:announcement_id>')
@login_required
def detail(announcement_id):
    # 这里可以根据announcement_id从数据库获取详细公告内容
    # 目前先渲染对应的模板文件
    if announcement_id == 1:
        return render_template('annotate/borrow_rules.html',
                            title="图书借阅规则详情",
                            content="这里是详细的图书借阅规则内容...")
    elif announcement_id == 2:
        return render_template('annotate/new_books.html',
                            title="新书推荐详情",
                            content="这里是详细的新书推荐内容...")
    elif announcement_id == 3:
        return render_template('annotate/service_guide.html',
                            title="服务指南详情",
                            content="这里是详细的服务指南内容...")
    else:
        return render_template('annotate/index.html')


